package com.huawei.test;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s1 = in.next();

		int tmp = s1.length();
		String[] sl = new String[tmp];

		for (int i = 0; i < tmp; i++) {
			sl[i] = s1.substring(i, i + 1);
			if (!(sl[i].compareTo("0") >= 0 || sl[i].compareTo("9") <= 0 || sl[i].compareTo(".") != 0)) {
				System.out.println(false);
				System.exit(0);
			}
		}

		for (int k = 0; k < tmp - 1; k++) {
			if (sl[k].equals(sl[k + 1])) {
				System.out.println(false);
				System.exit(0);
			}
		}
		String[] ss = s1.split("\\.");
		int le = ss.length;
		if (le != 4)
			System.out.println(false);
		for (int j = 0; j < le; j++) {
			if (Integer.valueOf(ss[j]) < 0 || Integer.valueOf(ss[j]) > 225) {
				System.out.println(false);
				System.exit(0);
			} 
		}
		System.out.println(true);
	}
}

